clear all
set more off
set matsize 1500

local date	"`c(current_date)'"
local user  "`c(username)'"

use "analysis.dta", clear

***************
*Summary stats*
***************

*Table A1*
estpost summarize ///
act act_dum exp1 exp2 exp3 exp4 hunger gender age edu politics 


esttab using "sumstat.tex", label booktabs title(Summary Statistics\label {tab1}) cells("mean sd min max") replace nomtitle nonum


use "analysis.dta", clear

************
*Regression*
************

*M1*
svy: mlogit act i.exp_con, rr
est sto M1

*M2*
svy: mlogit act i.exp_con enumerator, rr
est sto M2

esttab M1 M2, keep(2.exp_con 3.exp_con 4.exp_con) se label eform wide
esttab M1 M2 using "mlogit_act.tex", keep(2.exp_con 3.exp_con 4.exp_con) b(3) se label eform wide scalars(F) star (+ 0.10 * 0.05 ** 0.01 *** 0.001) replace

margins exp_con, l(90) post saving(exp_mlogit.dta, replace)
use exp_mlogit.dta, clear
lab var _predict "pr(Action)"

lab def action ///
	1 "Do nothing" ///
	2 "Ward meeting" ///
	3 "Labor strike" ///
	4 "Demonstration march" ///
	5 "Disrupt traffic"
lab val _predict action

*Figure A3*
format _margin %4.2f
twoway (bar _margin _predict if _predict == 1, fcolor(dknavy) lcolor(dknavy)) ///
	(bar _margin _predict if _predict == 2, fcolor(dkgreen) lcolor(dkgreen)) ///
	(bar _margin _predict if _predict == 3, fcolor(gold) lcolor(gold)) ///
	(bar _margin _predict if _predict == 4, fcolor(dkorange) lcolor(dkorange)) ///
	(bar _margin _predict if _predict == 5, fcolor(cranberry) lcolor(cranberry)) ///
	(rcap _ci_lb _ci_ub _predict, lcolor(gs12)) ///
	(scatter _margin _predict, mcolor(none) msize(zero) mlabel(_margin) ///
	mlabcolor(black) mlabposition(1) mlabgap(tiny)), by(_m1, rows(1) ///
	legend(off) note("", size(zero))) xlabel(1 "Do nothing" 2 "Ward meeting" ///
	3 "Labor strike" 4 "Demo march" 5 "Disrupt traffic", ///
	labsize(medlarge) angle(45)) ylabel(0(.2).7, format(%2.1f)) ///
	ymtick(##2, grid) ytitle("", size(zero)) xtitle("", size(zero)) ///
	scheme(s1color) xsize(6) ysize(2.5)
graph export "Essay3_exp_mlogit_marg.png", as(png) replace

*Figure A4*
twoway (bar _margin _m1 if _m1 == 1, fcolor(dknavy) lcolor(dknavy)) ///
	(bar _margin _m1 if _m1 == 2, fcolor(dkgreen) lcolor(dkgreen)) ///
	(bar _margin _m1 if _m1 == 3, fcolor(gold) lcolor(gold)) ///
	(bar _margin _m1 if _m1 == 4, fcolor(dkorange) lcolor(dkorange)) ///
	(rcap _ci_lb _ci_ub _m1, lcolor(gs12)) ///
	(scatter _margin _m1, mcolor(none) msize(zero) mlabel(_margin) ///
	mlabcolor(black) mlabposition(1) mlabgap(tiny)), ///
	xtitle("Experimental condition") xlabel(1(1)4) ///
	by(_predict, legend(on) noixtick noixlabel rows(1) note("", size(zero))) ///
	legend(region(lwidth(none)) order(1 "Stable cost of living" 2 "Fuel price increase" ///
	3 "Food price increase" 4 "Elec rate increase" 5 "90% CI") rows(1)) ///
	ylabel(0(.2).7, format(%2.1f)) ymtick(##2, grid) ytitle("Probability") ///
	scheme(s1color) xsize(6) ysize(2.5)
graph export "exp_mlogit_marg_by_action.png", as(png) replace


*Table A3*

*Model M3*
mlogit act_dum i.exp_con i.enumerator, b(0) rr
est sto M2_dum

*Model M4*
mlogit act_dum i.exp_con i.enumerator if hunger == 0, b(0) rr
est sto M2_dum_nohunger

*Model M5*
mlogit act_dum i.exp_con i.enumerator if hunger == 1, b(0) rr
est sto M2_dum_hunger

esttab M2_dum M2_dum_nohunger M2_dum_hunger, keep(2.exp_con 3.exp_con 4.exp_con) se label eform wide
esttab M2_dum M2_dum_nohunger M2_dum_hunger using "logit_results_act_dum.tex", keep(2.exp_con 3.exp_con 4.exp_con) b(3) se label eform wide scalars(F) star (+ 0.10 * 0.05 ** 0.01 *** 0.001) replace


*********************************************
***Dummy variable for each protest outcome***
*********************************************

***Equality of coefficients***

*Table A4*

*Model M6*
logit act_dum i.exp_con i.enumerator
est sto M6
test 2.exp_con 3.exp_con 4.exp_con
test 2.exp_con = 3.exp_con = 4.exp_con

*Model M7*
logit act2 i.exp_con i.enumerator
est sto M7
test 2.exp_con 3.exp_con 4.exp_con
test 2.exp_con = 3.exp_con = 4.exp_con

*Model M8*
logit act3 i.exp_con i.enumerator
est sto M8
test 2.exp_con 3.exp_con 4.exp_con
test 2.exp_con = 3.exp_con = 4.exp_con

*Model M9*
logit act4 i.exp_con i.enumerator
est sto M9
test 2.exp_con 3.exp_con 4.exp_con
test 2.exp_con = 3.exp_con = 4.exp_con

*Model M10*
logit act5 i.exp_con i.enumerator
est sto M10
test 2.exp_con 3.exp_con 4.exp_con
test 2.exp_con = 3.exp_con = 4.exp_con

esttab M6 M7 M8 M9 M10 , keep(2.exp_con 3.exp_con 4.exp_con) se label eform wide
esttab M6 M7 M8 M9 M10 using "logit_results.tex", keep(2.exp_con 3.exp_con 4.exp_con) b(3) se label eform wide scalars(F) star (+ 0.10 * 0.05 ** 0.01 *** 0.001) replace


**************************
***Adding more controls***
**************************

*Table A5*

*M11*
svy: mlogit act i.exp_con gender age edu politics, rr
est sto M11

*M12*
svy: mlogit act i.exp_con gender age edu politics enumerator, rr
est sto M12

esttab M11 M12, keep(2.exp_con 3.exp_con 4.exp_con) se label eform wide
esttab M11 M12 using "mlogit_controls.tex", keep(2.exp_con 3.exp_con 4.exp_con) b(3) se label eform wide scalars(F) star (+ 0.10 * 0.05 ** 0.01 *** 0.001) replace


